
module.exports= getBaiduToken = (address)=> {
    return new Promise((reslove,reject)=>{
        const axios = require('axios')
        const getBaiduToken = require('../tools/getBaiduToken')
        getBaiduToken().then(data=>{
            //console.log(data.access_token)
            const text = address
            const confidence = 100
            const url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/address?access_token='+ data.access_token
            axios({
                headers:{
                    'Content-Type': 'application/json'
                },
                method: 'POST',
                url,
                data: {
                    text,
                    confidence
                }
            }).then(res=>{
                //console.log('ok')
                reslove(res.data)
            })
         
        })

    })
}